﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>权限</title>
    <link href="~/EasyUI/themes/icon.css" rel="stylesheet" />
    <link href="~/EasyUI/themes/default/easyui.css" rel="stylesheet" />
    <script type="text/javascript" src="~/Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="~/EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.validate.min.js"></script>
    @* 自动为表单 添加验证功能的js文件 -- 微软提供
        <script type="text/javascript" src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    *@
    <script src="~/Scripts/Showdatetime.js"></script>

    <script type="text/javascript">
        $(function () {
            $('#editWindow').window('close');
            $("#tbList").datagrid({
                width: 'auto',
                height: 'auto',
                fitColumns: true,
                striped: true,
                singleSelect: true,
                url: '/admin/CaclPrice/DataList',
                //queryParams:{},
                loadMsg: '数据加载中请稍后……',
                columns: [[
                    { field: 'id', title: 'id', width: 30 },
                    { field: 'sellUserName', title: '提成人', width: 100 },
                    { field: 'DudectMoney', title: '提成价格', width: 100 },
                    { field: 'closePrice', title: '成交价', width: 100 },
                    { field: 'brandName', title: '品牌', width: 40 },
                    { field: 'xingHao', title: '型号', width: 100 },
                    {
                        field: 'regdate', title: '上户日期', width: 80, formatter: function (value) {
                            if (value == null || value == "") {
                                return '';
                            }
                            console.log(value);
                            var aa = eval('new ' + (value.replace(/\//g, '')));
                            return aa.format("yyyy-MM-dd");
                        }
                    },
                    {
                        field: 'CloseTime', title: '成交日期', width: 80, formatter: function (value) {
                            if (value == null || value == "") {
                                return '';
                            }
                            console.log(value);
                            var aa = eval('new ' + (value.replace(/\//g, '')));
                            return aa.format("yyyy-MM-dd");
                        }
                    }
                ]],
                onSelect: function (rowI, rowD) {
                    selectedRowIndex = rowI;//将选中行的下标 设置给全局变量
                },
                onDblClickRow: function () {
                    editRow();
                }
            });
               var loginName = '@ViewBag.loginname';
            if (loginName == "admin") {
                //加载店铺
                $.ajax({
                    type: "POST",
                    url: "/admin/Shop/DataList",
                    data: { page: 1, rows: 1000 },
                    dataType: "json",
                    success: function (data) {
                        // $('#shops').empty();   //清空shops里面的所有内容
                        var html = '';
                        $.each(data.rows, function (commentIndex, comment) {
                            html += '<option value="' + comment['ID'] + '"> ' + comment['ShopName'] + '</option>';
                        });
                        $('#shops').append(html);
                    }
                });
            }
            else {
                $("#spanshop").hide();
            }

            $("#btnserch").click(function () {
                $('#tbList').datagrid('load', {
                    Shopid: $('#shops').val(),
                    BeginTiem: $('#CloseBegin').val(),
                    EndTime: $('#CloseEnd').val(),
                });
            })

        })

        //$('#ff').submit();
    </script>
</head>
<body>
    <div style=" margin:15px 0px 20px 50px">

        卖出日期：
        <input id="CloseBegin" type="text" style="width:120px" placeholder="月/日/年" class="easyui-datebox">-
        <input id="CloseEnd" type="text" style="width:120px" placeholder="月/日/年" class="easyui-datebox">


        <span id="spanshop">
            所属店铺： <select id="shops">
                <option value="0"> 请选择</option>
            </select>
            &nbsp; &nbsp;
        </span>   &nbsp; &nbsp;
        <input id="btnserch" type="button" value="刷新" />

    </div>

    <table id="tbList" style="width:400px;height:250px"></table>

    <div id="editWindow" class="easyui-window" title="编辑账户" style="width:600px;height:400px;"
         data-options="iconCls:'icon-save',modal:true">

    </div>
</body>
</html>
